﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;

namespace SmileSolver
{
    public class SmileTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container)
        {
            if (item == null)
            {
                return Unknown;
            }
            else
            {
                SmileDescription desc = (SmileDescription)item;
                if (desc.Smile.Face == global::Solver.face.eye)
                {
                    if (desc.Side == SmileSide.Top)
                        return TopEye;
                    else if (desc.Side == SmileSide.Right)
                        return RightEye;
                    else if (desc.Side == SmileSide.Bottom)
                        return BottomEye;
                    else if (desc.Side == SmileSide.Left)
                        return LeftEye;

                    return null;
                }
                else
                {
                    if (desc.Side == SmileSide.Top)
                        return TopSmile;
                    else if (desc.Side == SmileSide.Right)
                        return RightSmile;
                    else if (desc.Side == SmileSide.Bottom)
                        return BottomSmile;
                    else if (desc.Side == SmileSide.Left)
                        return LeftSmile;

                    return null;
                }
            }
        }

        //
        public DataTemplate LeftEye { get; set; }
        public DataTemplate TopEye { get; set; }
        public DataTemplate RightEye { get; set; }
        public DataTemplate BottomEye { get; set; }
        //
        public DataTemplate LeftSmile { get; set; }
        public DataTemplate TopSmile { get; set; }
        public DataTemplate RightSmile { get; set; }
        public DataTemplate BottomSmile { get; set; }
        // 
        public DataTemplate Unknown { get; set; }

    }
}
